package sample.example1;

import browserhx.Browser;
import js.Dom;
import js.Lib;


class Main
{
	
	public static function main(){ new Main(); } public function new()
	{
		
		var img 				= Lib.document.createElement( "div" );
		var style 				= img.style;
		
		style.position 			=  "absolute";
		style.left 				= 15 + "px";
		style.top 				= 50 + "px";
		
		var imageLocation 		= 'browserIcons/' + Std.string( Browser.browserType )  + "BW.png" ;
		style.backgroundImage 	= 'url(' + imageLocation + ')';
		
		trace( Browser.browserType );
		Browser.traceAgent();
		
		if( Browser.hasCanvas2d )
		{
			trace('browser has canvas2d');
		}
		else
		{
			trace('browser does not have canvas2d');
		}
		Lib.document.getElementById("haxe:trace").innerHTML += __unhtml('test')+"<br/>";
		trace('test again');
		style.width 			= 32 + "px";
		style.height 			= 32 + "px";
		
		Lib.document.body.appendChild( img );
		
	}
	function __unhtml(s : String) {
		return s.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;");
	}
}